<?php
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use yii\widgets\LinkPager;
use mobile\controllers\ListController;
use common\models\articles\Articles;
use common\models\member\Member;
use common\models\category\Category;
use common\models\Ad\AdPosition;
use common\models\Ad\Ad;
    $ycgg = Ad::find()->where(['position_id'=>20])->one();//公告广告



?>
    <!--位置-->
    <div class="clearFloat bag-fff">
        <div class="sewz m-l-35 m-r-35">
            <a href="<?= yii\helpers\Url::to(['/']);?>">首页</a>-<a href="<?= yii\helpers\Url::to(['hyfabu/list','z_nav'=>0]); ?>">会员发布</a>
        </div>
    </div>
    <!--位置-->
    <!--列表-->
    <div class="selist bag-fff">
        <?php foreach($articles as $k=>$t){ ?>
        <div class="selista m-l-35 m-r-35">
            <a href="<?= yii\helpers\Url::to(['hyfabu/index', 'id' => $t['id']]); ?>">
                <div class="selistb">
                    <?=$t['title'];?>
                </div>
                <div class="seldat">
                    <?= date('Y-m-d H:i',$t['updated_at']);?>
                </div>
            </a>
        </div>
        <?php } ?>
        <a  href="JavaScript:;"  class="ggmore" id="aaa">点击加载更多</a>
    </div>

<script>
    $('.ggmore').click(function(){

       var articlecount = $('.selista').length;
        var url = "<?= yii\helpers\Url::to(['hyfabu/zenjia','_csrf'=>Yii::$app->request->csrfToken,]); ?>"+'&articlecount='+articlecount;
        $.getJSON(url,function(data){
            $.each(data, function(i, item){
                var html = '<div class="selista m-l-35 m-r-35"><a href="<?= yii\helpers\Url::to(['hyfabu/index']);?>/'+item.id+'">  <div class="selistb">'+item.title+'</div><div class="seldat">'+item.time+'</div></a></div>';
                $('.selist').append(html);
                if(item.content == 1){
                    document.getElementById("aaa").innerHTML="没有更多了";
                }
            })
        })





    })
</script>

    <!--列表-->
    <!--搜索-->
